Hệ thống quản lý ISP trong PHP
1 +<?php include 'includes/header.php'; ?>
2 <?php
3 require_once "includes/classes/admin-class.php";
4 $admins = new Admins($dbh);
5 if(isset($_POST['for'])){
6 //$date = $_POST['date'];
7 $amount = $_POST['amount'];
8 $for = $_POST['for'];
9 $remarks = $_POST['remarks'];
10 if(!$admins->expanse($amount, $for, $remarks)){
11 echo "Something went wrong ! Try again later.";
12 }else{
13 echo "Expanse added !";
14 }
15 }
16 ?>
17 <div class="dashboard">
18 <div class="col-md-12">
19 <div class="col-md-9">
20 <h3><a href="daily_data.php" class="btn btn-sm btn-primary"> Back</a> Expanse History</h3>
21 </div>
22 <div class="col-md-3 pull-right">
23 <form class="form-inline pull-right">
24 <div class="form-group">
25 <label class="sr-only" for="search">Search for</label>
26 <div class="input-group">
27 <div class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></div>
28 <input type="text" class="form-control" id="search" placeholder="Type a name">
29 <div class="input-group-addon"></div>
30 </div>
31 </div>
32 <!-- <button type="submit" class="btn btn-info">Search</button> -->
33 </form>
34 </div>
35 <hr>
36 <div class="col-md-12 col-sm-12">
37 <table class="table center table-striped table-bordered" id="grid-basic">
38 <thead class="thead-inverse">
39 <tr class="info">
40 <th>ID </th>
41 <th>Date</th>
42 <th>Amount</th>
43 <th>Purpose</th>
44 <th>Remarks</th>
45 <th>Action</th>
46 </tr>
47 </thead>
48 <tbody>
49 <?php
50 $expanse = $admins->fetchExpanse();
51 if (isset($expanse) && sizeof($expanse) > 0){
52 foreach($expanse as $exp) {
53 ?>
54 <tr>
55 <td><?=$exp->id?></td>
56 <td class="search"><?=date("jS F y",strtotime($exp->created_at))?></td>
57 <td class="search"><?=$exp->amount?></td>
58 <td class="search"><?=$exp->purpose?></td>
59 <td class="search"><?=$exp->remarks?></td>
60 <td><button type="button" data-id="<?=$exp->id?>" class="btn btn-danger btn-sm delete disabled">DELETE</button></td>
61 </tr>
62 <?php }} ?>
63 </tbody>
64 </table>
65 </div>
66 </div>
67 <?php include 'includes/footer.php'; ?>
68 <script type="text/javascript">
69 document.getElementById('date').valueAsDate = new Date();
70 </script>
71 <script type="text/javascript">
72 $(function() {
73 grid = $('#grid-basic');
74
75 // handle search fields of members key up event
76 $('#search').keyup(function(e) {
77 text = $(this).val(); // grab search term
78
79 if(text.length > 1) {
80 grid.find('tr:has(td)').hide(); // hide data rows, leave header row showing
81
82 // iterate through all grid rows
83 grid.find('tr').each(function(i) {
84 // check to see if search term matches Name column
85 if($(this).find('.search').text().toUpperCase().match(text.toUpperCase()))
86 $(this).show(); // show matching row
87 });
88 }
89 else
90 grid.find('tr').show(); // if no matching name is found, show all rows
91 });
92
93 });
94 </script>